<template>
	<view class="assign-task-detail">
		<view class="finish-summary">
			{{`已分配${processList.length}人，已有${processList.filter(item=>item.finishStatus).length}人完成`}}
		</view>
		<view class="finish-tatus-list">
			<view class="process-item" v-for="item in processList" :key="item.avatar">
				<image :src="item.avatar" v-if="item.avatar" class="user-avatar" />
				<view class="empty-avatar user-avatar" v-else>
					{{item.userName.slice(0,1).toUpperCase()}}
				</view>
				<view class="name">
					{{item.userName}}
				</view>
				<view class="complete">
					{{item.finishCount}}/{{item.stepCount}}
				</view>
				<view class="status" :class="item.finishStatus&&'finish'">
					{{item.finishStatus?'已完成':'未完成'}}
				</view>
			</view>

		</view>

	</view>
</template>

<script>
	export default {
		props: {
			processList: {
				type: Array,
				default: () => []
			}
		}
	}
</script>

<style scoped lang="scss">
	.assign-task-detail {
		width: 100vw;
		max-height: 50vh;
		padding: 24px 12px 12px 12px;
		background-color: #fff;
		box-sizing: border-box;
		border-radius: $uni-border-radius-lg $uni-border-radius-lg 0 0;
		color: #333;
		font-size: 28upx;

	}
	.finish-tatus-list{
		margin-top: 36upx;
		height: 100%;
		overflow-y: scroll;
		font-size: 24upx;
	}

	.process-item {
		&:not(:first-child){
			margin-top: 24upx;
		}
		.user-avatar {
			width: 80upx;
			height: 80upx;
			border-radius: 50%;
			&.empty-avatar {
				background-color: blue;
				color: #fff;
				line-height: 80upx;
				text-align: center;
			}
		}

		.name {
			flex: 1;
			margin-left: 24upx;
		}

		.complete {
			flex: 1;

		}

		.status {
			flex: 1;
			width: 80upx;
			&.finish{
				color: green;
			}

		}

		display: flex;
		align-items: center;
	}
</style>